package net.zjitc.dao;


import net.zjitc.pojo.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Repository
public interface BookDao {
    @Select("select * from books;")
    public List<Book> findAll();
    @Insert("insert into books (name,isbn,author,price,press) values (#{name},#{isbn},#{author},#{price},#{press});")
    public void save(Book book);
    @Select("select * from books where id = #{id};")
    public Book findById(int id);
    @Delete("delete from books where id = #{id};")
    public void delete(int id);
    @Update("update books set name = #{name} ,isbn = #{isbn}, author = #{author},price = #{price},press = #{press} where id = #{id};")
    public void update(Book book);
    public List<Book> findByCondition(Book book);

}
